let chartDataStr = decodeHtml(chartData);
let chartJsonArray = JSON.parse(chartDataStr);

let arrayLength = chartJsonArray.length;
let numericData = [];
let labelData = [];

for (let i = 0; i < arrayLength; i++) {
    numericData[i] = chartJsonArray[i].value;
    labelData[i] = chartJsonArray[i].label;

}

//饼图
const data = {
    labels: labelData,
    // labels:[
    //     'Red',
    //     'Blue',
    //     'Yellow',
    // ],
    datasets: [{
        label: 'My First Dataset',
        data: numericData,
        // data:[300, 50, 100],
        backgroundColor: [
            'rgb(255, 99, 132)',
            'rgb(54, 162, 235)',
            'rgb(255, 205, 86)'
        ],
        hoverOffset: 4
    }]
};
// 配置选项
const options = {
    plugins:{
        title:{
            display:true,
            text:'项目状态'
        }
    }
}

new Chart(document.getElementById("myPieChart"),
    {
        type:'pie',
        data:data,
         options:options

    })
//  "[{"value":1,"label": "未开始"},{"value":2 "label": "进行中"}, {"value":1,"label": "已完成"}]"
function decodeHtml(html){
    let txt = document.createElement("textarea");
    txt.innerHTML = html;
    return txt.value;
}